<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>The SimpleXMLElement class</title>

 </head>
 <body><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="simplexml.examples-errors.html">Dealing with XML errors</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="simplexmlelement.addattribute.html">SimpleXMLElement::addAttribute</a></div>
 <div class="up"><a href="book.simplexml.html">SimpleXML</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div><hr /><div id="class.simplexmlelement" class="reference">
 <h1 class="title">The SimpleXMLElement class</h1>
 
 
 <div class="partintro"><p class="verinfo">(PHP 5 &gt;= 5.0.1)</p>
 

  <div class="section" id="simplexmlelement.intro">
   <h2 class="title">简介</h2>
   <p class="para">
    Represents an element in an XML document.
   </p>
  </div>

 
  <div class="section" id="simplexmlelement.synopsis">
   <h2 class="title">类摘要</h2>
 

   <div class="classsynopsis">
    <div class="ooclass"></div>
 

    <div class="classsynopsisinfo">
     <span class="ooclass">
      <strong class="classname">SimpleXMLElement</strong>
     </span>
     
     <span class="oointerface">implements 
      <span class="interfacename"><strong class="interfacename">Traversable</strong></span>
     </span>
     {</div>

 
    <div class="classsynopsisinfo classsynopsisinfo_comment">/* 方法 */</div>
    <div class="constructorsynopsis dc-description">
   <span class="modifier">final</span> <span class="modifier">public</span> <span class="methodname"><a href="simplexmlelement.construct.html" class="methodname">__construct</a></span>
    ( <span class="methodparam"><span class="type">string</span> <code class="parameter">$data</code></span>
   [, <span class="methodparam"><span class="type">int</span> <code class="parameter">$options</code><span class="initializer"> = 0</span></span>
   [, <span class="methodparam"><span class="type">bool</span> <code class="parameter">$data_is_url</code><span class="initializer"> = false</span></span>
   [, <span class="methodparam"><span class="type">string</span> <code class="parameter">$ns</code><span class="initializer"> = &quot;&quot;</span></span>
   [, <span class="methodparam"><span class="type">bool</span> <code class="parameter">$is_prefix</code><span class="initializer"> = false</span></span>
  ]]]] )</div>

    <div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="type">void</span><span class="methodname"><a href="simplexmlelement.addattribute.html" class="methodname">addAttribute</a></span>
    ( <span class="methodparam"><span class="type">string</span> <code class="parameter">$name</code></span>
   [, <span class="methodparam"><span class="type">string</span> <code class="parameter">$value</code></span>
   [, <span class="methodparam"><span class="type">string</span> <code class="parameter">$namespace</code></span>
  ]] )</div>
<div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="type">SimpleXMLElement</span><span class="methodname"><a href="simplexmlelement.addchild.html" class="methodname">addChild</a></span>
    ( <span class="methodparam"><span class="type">string</span> <code class="parameter">$name</code></span>
   [, <span class="methodparam"><span class="type">string</span> <code class="parameter">$value</code></span>
   [, <span class="methodparam"><span class="type">string</span> <code class="parameter">$namespace</code></span>
  ]] )</div>
<div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="type">mixed</span><span class="methodname"><a href="simplexmlelement.asxml.html" class="methodname">asXML</a></span>
    ([ <span class="methodparam"><span class="type">string</span> <code class="parameter">$filename</code></span>
  ] )</div>
<div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="type">SimpleXMLElement</span><span class="methodname"><a href="simplexmlelement.attributes.html" class="methodname">attributes</a></span>
    ([ <span class="methodparam"><span class="type">string</span> <code class="parameter">$ns</code><span class="initializer"> = <strong><code>NULL</code></strong></span></span>
   [, <span class="methodparam"><span class="type">bool</span> <code class="parameter">$is_prefix</code><span class="initializer"> = false</span></span>
  ]] )</div>
<div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="type">SimpleXMLElement</span><span class="methodname"><a href="simplexmlelement.children.html" class="methodname">children</a></span>
    ([ <span class="methodparam"><span class="type">string</span> <code class="parameter">$ns</code></span>
   [, <span class="methodparam"><span class="type">bool</span> <code class="parameter">$is_prefix</code><span class="initializer"> = false</span></span>
  ]] )</div>
<div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="type">int</span><span class="methodname"><a href="simplexmlelement.count.html" class="methodname">count</a></span>
    ( <span class="methodparam">void</span>
   )</div>
<div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="type">array</span><span class="methodname"><a href="simplexmlelement.getdocnamespaces.html" class="methodname">getDocNamespaces</a></span>
    ([ <span class="methodparam"><span class="type">bool</span> <code class="parameter">$recursive</code><span class="initializer"> = false</span></span>
   [, <span class="methodparam"><span class="type">bool</span> <code class="parameter">$from_root</code><span class="initializer"> = true</span></span>
  ]] )</div>
<div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="type">string</span><span class="methodname"><a href="simplexmlelement.getname.html" class="methodname">getName</a></span>
    ( <span class="methodparam">void</span>
   )</div>
<div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="type">array</span><span class="methodname"><a href="simplexmlelement.getnamespaces.html" class="methodname">getNamespaces</a></span>
    ([ <span class="methodparam"><span class="type">bool</span> <code class="parameter">$recursive</code><span class="initializer"> = false</span></span>
  ] )</div>
<div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="type">bool</span><span class="methodname"><a href="simplexmlelement.registerxpathnamespace.html" class="methodname">registerXPathNamespace</a></span>
    ( <span class="methodparam"><span class="type">string</span> <code class="parameter">$prefix</code></span>
   , <span class="methodparam"><span class="type">string</span> <code class="parameter">$ns</code></span>
   )</div>
<div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="type">string</span><span class="methodname"><a href="simplexmlelement.tostring.html" class="methodname">__toString</a></span>
    ( <span class="methodparam">void</span>
   )</div>
<div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="type">array</span><span class="methodname"><a href="simplexmlelement.xpath.html" class="methodname">xpath</a></span>
    ( <span class="methodparam"><span class="type">string</span> <code class="parameter">$path</code></span>
   )</div>

   }</div>

 
  </div>
 
 </div>
 
 







































 

















































<h2>Table of Contents</h2><ul class="chunklist chunklist_reference"><li><a href="simplexmlelement.addattribute.html">SimpleXMLElement::addAttribute</a> — Adds an attribute to the SimpleXML element</li><li><a href="simplexmlelement.addchild.html">SimpleXMLElement::addChild</a> — Adds a child element to the XML node</li><li><a href="simplexmlelement.asxml.html">SimpleXMLElement::asXML</a> — Return a well-formed XML string based on SimpleXML element</li><li><a href="simplexmlelement.attributes.html">SimpleXMLElement::attributes</a> — Identifies an element's attributes</li><li><a href="simplexmlelement.children.html">SimpleXMLElement::children</a> — Finds children of given node</li><li><a href="simplexmlelement.construct.html">SimpleXMLElement::__construct</a> — Creates a new SimpleXMLElement object</li><li><a href="simplexmlelement.count.html">SimpleXMLElement::count</a> — Counts the children of an element</li><li><a href="simplexmlelement.getdocnamespaces.html">SimpleXMLElement::getDocNamespaces</a> — Returns namespaces declared in document</li><li><a href="simplexmlelement.getname.html">SimpleXMLElement::getName</a> — Gets the name of the XML element</li><li><a href="simplexmlelement.getnamespaces.html">SimpleXMLElement::getNamespaces</a> — Returns namespaces used in document</li><li><a href="simplexmlelement.registerxpathnamespace.html">SimpleXMLElement::registerXPathNamespace</a> — Creates a prefix/ns context for the next XPath query</li><li><a href="simplexmlelement.savexml.html">SimpleXMLElement::saveXML</a> — 别名 SimpleXMLElement::asXML</li><li><a href="simplexmlelement.tostring.html">SimpleXMLElement::__toString</a> — Returns the string content</li><li><a href="simplexmlelement.xpath.html">SimpleXMLElement::xpath</a> — Runs XPath query on XML data</li></ul>
</div>
<hr /><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="simplexml.examples-errors.html">Dealing with XML errors</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="simplexmlelement.addattribute.html">SimpleXMLElement::addAttribute</a></div>
 <div class="up"><a href="book.simplexml.html">SimpleXML</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div></body></html>
